const modules = import.meta.glob('/src/views/**/*.vue')
const layout = { path: '/', component: () => import('layouts/MainLayout.vue'), children: [] }

export function dynamicRouter (menuList = [], router) {
  for (const menu of menuList) {
    if (!menu.path) continue
    menu.component = modules[`/src/views${menu.path}.vue`] || modules['/src/views/Developing.vue']
    layout.children.push(menu)
  }
  router.addRoute(layout)
}